UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lrluC1hJlRmCzVM857zzQQ0NUZFd8R9ZccN7mOe1zSw=' 
WHERE 
  key_id = '2309fb7a26acabaaaf7f5bb2682565835465c965f0027d60ba0232053c26d356' 
  AND (
    token = 'lrluC1hJlRmCzVM857zzQQ0NUZFd8R9ZccN7mOe1zSw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035