UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e6FqbtcNH41m5lLDI+DNAeRWUCP9bcjY2IXiocx3G8Y=' 
WHERE 
  key_id = 'd6f94f91366fb705461468dc9a749a42607b9c9b0b88bb30cd5cab3b2121c752' 
  AND (
    token = 'e6FqbtcNH41m5lLDI+DNAeRWUCP9bcjY2IXiocx3G8Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026