UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ApHJre8+H9Xak/8e+60b9di5y+DuOdgb7rymXzQJvYQ=' 
WHERE 
  key_id = '003062baace4801412c93d2d33f5ddd3cb344a468b6edf9d94e62890b13b7046' 
  AND (
    token = 'ApHJre8+H9Xak/8e+60b9di5y+DuOdgb7rymXzQJvYQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050