UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eMDBvqz9L+LDmuSbBPxAq2SSReA7lKgKOPFZWS/q20o=' 
WHERE 
  key_id = '248527e76cb770052a89f5b9295e46b7285d81dcdfab9da02e6f08d6540da538' 
  AND (
    token = 'eMDBvqz9L+LDmuSbBPxAq2SSReA7lKgKOPFZWS/q20o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026