UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZUIkL0+R9k5sr+1nN4U6wfhHjAqVeQQSk0pTZBq8yQ0=' 
WHERE 
  key_id = 'ccccf048564c04eef8cb4071d12428e8a6296874848aa50d2d0567f3a0f66f68' 
  AND (
    token = 'ZUIkL0+R9k5sr+1nN4U6wfhHjAqVeQQSk0pTZBq8yQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054