UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BeJ4/ae8jmxkd93rjgPIoYwuMTNtAgqlYIMMqH+6lI0=' 
WHERE 
  key_id = 'f770ab84b579b5a5f5eae3987ea7942a7a5ead49854b3d05491a7adeb52ec812' 
  AND (
    token = 'BeJ4/ae8jmxkd93rjgPIoYwuMTNtAgqlYIMMqH+6lI0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043