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

Query time 0.00023