UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v1rrn6HJqUHpfNGULfxB8JK5HxVYn/LSWVkjpAx7IwQ=' 
WHERE 
  key_id = 'e48a69ac91b2f591c36e3f12be95498b72d3212502b16da1dfe29e535be70631' 
  AND (
    token = 'v1rrn6HJqUHpfNGULfxB8JK5HxVYn/LSWVkjpAx7IwQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043