UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RKrt7b/evy2/aUUDxxfIF84RQCQ/VR/5x3nbu/cjcHQ=' 
WHERE 
  key_id = 'd5d5453aa84a42e2cc393079906cbf224c92802f825ea8574796509503b639c4' 
  AND (
    token = 'RKrt7b/evy2/aUUDxxfIF84RQCQ/VR/5x3nbu/cjcHQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032