UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fAMFiivuq5vWszausQBnaLPicebQdJO8ynZ/xJFQ140=' 
WHERE 
  key_id = '99c52c6c114d0e5d8a2d6032bd814ef6edd002eae9011db6f6ba6b9c5f74fc5d' 
  AND (
    token = 'fAMFiivuq5vWszausQBnaLPicebQdJO8ynZ/xJFQ140=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050