UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MbdYLNZ5IMxRkgLlppgvgEilauut77degvVBvJKVK1g=' 
WHERE 
  key_id = '15c2c477a9cb3772a73f71d9d83b3d12778c9e0dd41b47235ccb1ddbecf269c3' 
  AND (
    token = 'MbdYLNZ5IMxRkgLlppgvgEilauut77degvVBvJKVK1g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051