UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xpLGAziiQuLAHind+AwDja2ZQed47hmCC1ozKwnJ9Iw=' 
WHERE 
  key_id = 'a54733f08a107eb13713eb91a506bac454ff826a172147f33ee6bddde9e773ce' 
  AND (
    token = 'xpLGAziiQuLAHind+AwDja2ZQed47hmCC1ozKwnJ9Iw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040