UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vscnb1ImEQQpkVRhrn9X+VEDDjgObelgW4LchLkjyXc=' 
WHERE 
  key_id = 'e1dbcc4c885616201aa18a275108d562ea255e609d058331353c64d00282c2b0' 
  AND (
    token = 'vscnb1ImEQQpkVRhrn9X+VEDDjgObelgW4LchLkjyXc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053