UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1sIWXMLNj9bhyivVxG0sOohLfkevVtAm+WtwZFx80vg=' 
WHERE 
  key_id = '6670781dad19f88e744736f334e1adc0bf5154f7f003f8045a3aeb820e908718' 
  AND (
    token = '1sIWXMLNj9bhyivVxG0sOohLfkevVtAm+WtwZFx80vg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048