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

Query time 0.00048