UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'llZchG8Bo2wIecRToT3QcbAHatmesq2x0zt0mL60fPM=' 
WHERE 
  key_id = '675f91eab340f601c95156c3bd3f13f65082cf1b5edacf3384ece8c1115f0073' 
  AND (
    token = 'llZchG8Bo2wIecRToT3QcbAHatmesq2x0zt0mL60fPM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050