UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dlhTSWQyZR9R1R6S7FJzIt5r3KoAIHoXnspu1ha//x4=' 
WHERE 
  key_id = '29eefbc37f53af2f4480a133c5af32d9e1139040263b77285e83d1807b8bc217' 
  AND (
    token = 'dlhTSWQyZR9R1R6S7FJzIt5r3KoAIHoXnspu1ha//x4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053