UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q+g04w6DzbtQMrgzSiE5MsWfNbuyIfh3RQXdkAR6GFs=' 
WHERE 
  key_id = 'a247ee3fc98a14ac87ef28757fea7f400f5a7bd2b9888fb4595a02f03c061b12' 
  AND (
    token = 'q+g04w6DzbtQMrgzSiE5MsWfNbuyIfh3RQXdkAR6GFs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030