UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MK4b/VXYzY1SzeKP2PiE3vU1J57KClsEaEuXBac2yOk=' 
WHERE 
  key_id = 'b913a43c17e40e32c272f18f65b9b29c02f07aa0a5cb75767897a526168b04b5' 
  AND (
    token = 'MK4b/VXYzY1SzeKP2PiE3vU1J57KClsEaEuXBac2yOk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038