UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/BfK3FKwYrnKnb+1YFUJekggy55JQ8g9fpItixhPxss=' 
WHERE 
  key_id = '32948ddfcee54801a642b3af6ba448b35159c32bd9c3f2dc48fc576304068df0' 
  AND (
    token = '/BfK3FKwYrnKnb+1YFUJekggy55JQ8g9fpItixhPxss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035