UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BZDE+AjalOJf0cNn52j2ebauqG5sX9UwAcVhaQuVYus=' 
WHERE 
  key_id = 'fc9f780e4655d586a974370067880d2db1273a4fe72cd6e9e65ef56cbf89341c' 
  AND (
    token = 'BZDE+AjalOJf0cNn52j2ebauqG5sX9UwAcVhaQuVYus=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023