UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vsmcLx/UOo9fVrU/PFiaYGRhYXhl/+gvAGic4hZiyMY=' 
WHERE 
  key_id = 'e791589fbf01f70dbcf3610a9a2c09682afadb2dbd22c200afb79576be753320' 
  AND (
    token = 'vsmcLx/UOo9fVrU/PFiaYGRhYXhl/+gvAGic4hZiyMY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018