UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BCxtFYRcPfq8AaFoS/rbGGJx079R5jTcCOFUpQGwvM4=' 
WHERE 
  key_id = '332f75be8d06abb72e8c85fdb98532b7e37c7507b53c62fc4f1e25611ff1c2ff' 
  AND (
    token = 'BCxtFYRcPfq8AaFoS/rbGGJx079R5jTcCOFUpQGwvM4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030