UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TfuTuhPhJdDQus0hvgvldJRbzYtQBQ68AKnB+VM9Ob8=' 
WHERE 
  key_id = '5afbf3c68444c8dc919cd1e1a4d393469adda8bfa8e4caa1facfdf4c75681a4f' 
  AND (
    token = 'TfuTuhPhJdDQus0hvgvldJRbzYtQBQ68AKnB+VM9Ob8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023