UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fB+AB7r3hVVySLbO+8hcfLVgsvnV4aorr4qhxvkbjMg=' 
WHERE 
  key_id = '5c54cf7f0327216b12c923043a3ae4d9cf6ea17767d1403073cdd017a68b870b' 
  AND (
    token = 'fB+AB7r3hVVySLbO+8hcfLVgsvnV4aorr4qhxvkbjMg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037