UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5AaprpRqvwX3IM1W9oboEV4dWoU9Bccc6SQ/K2lE8pE=' 
WHERE 
  key_id = '0591d1b7552cd0fc2638c6caf5ccc37bc55522af7b578b96a9e7e7748d497d8a' 
  AND (
    token = '5AaprpRqvwX3IM1W9oboEV4dWoU9Bccc6SQ/K2lE8pE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036