UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jlQipqf4Xwz+6sX9jksNQ93x83b3ZXHmf4oOfS0Mepw=' 
WHERE 
  key_id = '989d3150b2716b730fc6fc2dd12e405e5ac7faccb0b374f3bd868237fc0f063e' 
  AND (
    token = 'jlQipqf4Xwz+6sX9jksNQ93x83b3ZXHmf4oOfS0Mepw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027