UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NvgTLYVH+QPLOkCUJzDPU9SYpNcPE/vcTpxmeiBIQ78=' 
WHERE 
  key_id = '0017a30031a80d8e8b811d790148538642546338479e29f09cb2c911893fb051' 
  AND (
    token = 'NvgTLYVH+QPLOkCUJzDPU9SYpNcPE/vcTpxmeiBIQ78=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017