UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L8/LVvUKjjDztA48TLVNWK8AoT4XWPMFZA9BhDiPVOs=' 
WHERE 
  key_id = '0b8dd9889b93c0927693161ef3f819065d857aabda442175a79e3e9abc4af0b0' 
  AND (
    token = 'L8/LVvUKjjDztA48TLVNWK8AoT4XWPMFZA9BhDiPVOs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037