UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rqRtfk106EgzED/IPZ05BphDqBDcpNaVGJFDvDgVYKQ=' 
WHERE 
  key_id = 'dede65801de5652e880d6b0bbe8c5237171273310733e7f06151fbb297200b99' 
  AND (
    token = 'rqRtfk106EgzED/IPZ05BphDqBDcpNaVGJFDvDgVYKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029