UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w0MXWg1fTQ6Cn2w1dWjRs/xTDR4WOy6QJdKTRf0yrg8=' 
WHERE 
  key_id = '456fe1d5e696ff6584239f0e2922b7e24d3195e34ed1c9aced595276285958c9' 
  AND (
    token = 'w0MXWg1fTQ6Cn2w1dWjRs/xTDR4WOy6QJdKTRf0yrg8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040