UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G9qoGqVuP4Qbl9tQtx5XcYB7HTJIHqeVuarSV81Jamg=' 
WHERE 
  key_id = '7782513f0ba38ad3052c13fe40d305d3035600b02e89de4c75ec183d44c46091' 
  AND (
    token = 'G9qoGqVuP4Qbl9tQtx5XcYB7HTJIHqeVuarSV81Jamg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017