UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QTVdFC/G/pha8hH8EcOn/5HRgL0yoDtzr+I2NTkxUH8=' 
WHERE 
  key_id = '21edafdff016bac329fcda61c87ca635be625ed3006b79a760cd0aad140311a4' 
  AND (
    token = 'QTVdFC/G/pha8hH8EcOn/5HRgL0yoDtzr+I2NTkxUH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031