UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EqZOcBc6/4PGPPAN6GJwD0kcktT5hXyMgltLCxIgAZk=' 
WHERE 
  key_id = 'a4e42756888631a2dae07851a5dba3a69dd31c455121af116db178e0f3ef8904' 
  AND (
    token = 'EqZOcBc6/4PGPPAN6GJwD0kcktT5hXyMgltLCxIgAZk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032