UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jmWThdQEN+Iy87aEce29d3xo9BYq7UuGJUFEDHXFqY0=' 
WHERE 
  key_id = '593b9162ffef077432c48bfc68585754056d3c5b1d7254b28e2c8dbe762151e5' 
  AND (
    token = 'jmWThdQEN+Iy87aEce29d3xo9BYq7UuGJUFEDHXFqY0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042