UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qUWl6XDMItc/6MP/3GCCukEtwr3qlQ7I+wPbc+vcjT0=' 
WHERE 
  key_id = '30d7fb3e06eae932c7d307bcd0db44853d8a7f9cb46f1dd3b30e8fe085642118' 
  AND (
    token = 'qUWl6XDMItc/6MP/3GCCukEtwr3qlQ7I+wPbc+vcjT0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024