UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UgKdzOkhtmubi+28GSVbrW4mtafgpwprnT3L8qwPggs=' 
WHERE 
  key_id = '32c0c7b97cb612cf180508f161012afe382aaad5711a8c16c1590d102f2a8fa2' 
  AND (
    token = 'UgKdzOkhtmubi+28GSVbrW4mtafgpwprnT3L8qwPggs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018