UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BfgUfL0x6TYBoe5vYl2ISl5H7Yia1XkMIzRGw6WkF68=' 
WHERE 
  key_id = 'a0b405df6fc43d0db49afbcf6e631a8e641fc527d80fec31776ea92c98f1f332' 
  AND (
    token = 'BfgUfL0x6TYBoe5vYl2ISl5H7Yia1XkMIzRGw6WkF68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043