UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IEN6aW89fI4C6qCebPFktaeRvVuhXWSTi1xa1QGmXmc=' 
WHERE 
  key_id = '39809b15be12e28cad166bf85c99f9d2a3ecc8d93e31d3cf5e117e045723e8d9' 
  AND (
    token = 'IEN6aW89fI4C6qCebPFktaeRvVuhXWSTi1xa1QGmXmc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041