UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pq8gB6yyqjapJSBLB5w2G+AgTxnimzXcnXCSHxco9J8=' 
WHERE 
  key_id = '2e0b0c93318b1d98c43b205927fdea99a1fc402deb5de3f95c09bf71727003da' 
  AND (
    token = 'pq8gB6yyqjapJSBLB5w2G+AgTxnimzXcnXCSHxco9J8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038