UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5ghomtRGfKxuejzN/r4Fbnbgz52W7Bkfs08TrWf90mU=' 
WHERE 
  key_id = 'b989b1473c0ac55dcb73062a04409cc8c4c31a0323f996abc5d77fa52005f354' 
  AND (
    token = '5ghomtRGfKxuejzN/r4Fbnbgz52W7Bkfs08TrWf90mU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017