UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'foKzcIO4sDqT+CGqeXn+vmIudWxSN4SQzaX+Yx5e0KA=' 
WHERE 
  key_id = 'ece978002573596c485be752b1b62b784dd7343440436a651de28d15124fad97' 
  AND (
    token = 'foKzcIO4sDqT+CGqeXn+vmIudWxSN4SQzaX+Yx5e0KA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030