UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YMTzsXuDN7bnmCztlir5gD0MW0mqv6ehoyXCNs7oQ8k=' 
WHERE 
  key_id = '5410a1b618f81e88188cdc6d9abcd1c56fc501efc324bcf29dfeb26b3ed946ac' 
  AND (
    token = 'YMTzsXuDN7bnmCztlir5gD0MW0mqv6ehoyXCNs7oQ8k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025